tools/ocaml/xc: Address ABI issues with physinfo arch flags
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 25 Jul 2022 17:36:29 +0000 (18:36 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 13 Oct 2022 10:45:19 +0000 (11:45 +0100)
commit0823d57d71c7023bea94d483f69f7b5e62820102
tree1fcee79280991b88664cf96439da477ba72b6860
parent1f232670f806d20471fc4205069448292e2df2df
tools/ocaml/xc: Address ABI issues with physinfo arch flags

The current bindings function, but the preexisting

  type physinfo_arch_cap_flag =
         | X86 of x86_physinfo_arch_cap_flag

is a special case in the Ocaml type system with an unusual indirection, and
will break when a second option, e.g. `| ARM of ...` is added.

Also, the position the list is logically wrong.  Currently, the types express
a list of elements which might be an x86 flag or an arm flag (and can
intermix), whereas what we actually want is either a list of x86 flags, or a
list of ARM flags (that cannot intermix).

Rework the Ocaml types to avoid the ABI special case and move the list
primitive, and adjust the C bindings to match.

Fixes: 2ce11ce249a3 ("x86/HVM: allow per-domain usage of hardware virtualized APIC")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Christian Lindig <christian.lindig@citrix.com>
Release-acked-by: Henry Wang <Henry.Wang@arm.com>
tools/ocaml/libs/xc/xenctrl.ml
tools/ocaml/libs/xc/xenctrl.mli
tools/ocaml/libs/xc/xenctrl_stubs.c